package com.wanglei.rdd.transform

import org.apache.spark.{SparkConf, SparkContext}

object Spark12_sortby {

  def main(args: Array[String]): Unit = {

    //
    val conf = new SparkConf().setMaster("local[2]").setAppName("map")
    val sc = new SparkContext(conf)


    // sortby不会修改分区数量，但是会存在shuffle
    val rdd = sc.makeRDD(List(4, 5, 6, 3, 2, 1, 6, 9, 4), 4)

    rdd.sortBy(num => num)
      .saveAsTextFile("output")


    //
    sc.stop()

  }

}
